var myPlugin = {
  timeControl: function (start, end, weekNum, funcin, funcout) {
    start = start.split(':');
    var startH = parseInt(start[0]);
    var startM = parseInt(start[1]);
    start = startH * 60 + startM;

    end = end.split(':');
    var endH = parseInt(end[0]);
    var endM = parseInt(end[1]);
    end = endH * 60 + endM;

    var now = new Date();
    var week = now.getDay();
    console.log(week);
    //console.log(now);
    var nowH = now.getHours();
    var nowM = now.getMinutes();
    now = nowH * 60 + nowM;

    if (weekNum == undefined) {
      if(week == 0 || week == 6){
        funcout();
      }else{
        if (now < start) {
          funcout();
          setTimeout(funcin, (start - now) * 60 * 1000);
          setTimeout(funcout, (end - now) * 60 * 1000);
        } else if (now <= end) {
          funcin();
          setTimeout(funcout, (end - now) * 60 * 1000);
        } else {
          funcout();
        }
      }

    } else if (typeof weekNum == 'number') {
      if(week==weekNum){
        if (now < start) {
          funcout();
          setTimeout(funcin, (start - now) * 60 * 1000);
          setTimeout(funcout, (end - now) * 60 * 1000);
        } else if (now <= end) {
          funcin();
          setTimeout(funcout, (end - now) * 60 * 1000);
        } else {
          funcout();
        }
      }else{
        funcout();
      }
    }
  }
};